import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:juming_test/config/home_images.dart';
import 'package:carousel_slider/carousel_slider.dart';
import 'package:juming_test/model/home/home_banner_model.dart';

class HomeBanner extends StatelessWidget {
  const HomeBanner({super.key, required this.bannerList});
  // banner数据
  final List<HomeBannerModel> bannerList;

  @override
  Widget build(BuildContext context) {
    return Container(
      color: Colors.white,
      width: double.infinity,
      height: 150.w,
      child: CarouselSlider(
        items:
            bannerList.map((item) {
              return Container(
                width: double.infinity,
                padding: EdgeInsets.symmetric(horizontal: 16.w),
                child: Image.asset(
                  HomeImages.homeFinancialZjePng,
                  fit: BoxFit.fill,
                ),
              );
            }).toList(),
        options: CarouselOptions(autoPlay: true, viewportFraction: 1),
      ),
    );
  }
}
